/**
 * Copyright (c) 2011-2020, hubin (jobob@qq.com).
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.agree.util.excel.entity;

import com.agree.util.excel.util.StringUtils;

import java.util.List;

/**
 * <p>
 * 表信息，关联到当前字段信息
 * </p>
 *
 * @author YangHu
 * @since 2016/8/30
 */
public class TableInfo {

    private String name;
    private String prex = "TB_UCC";
    private String comment;
    private List<TableField> fields;//主键列
    private TableKey tableKey;      //主键

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public List<TableField> getFields() {
        return fields;
    }

    public void setFields(List<TableField> fields) {
        this.fields = fields;
    }

    public TableKey getTableKey() {
        return tableKey;
    }

    public void setTableKey(TableKey tableKey) {
        this.tableKey = tableKey;
    }

    public String getHumpName() {
        String replace = name;
        if(StringUtils.isNotEmpty(name)) {
            replace = name.replace(prex, "").toLowerCase();
            return StringUtils.firstToUpperCase(replace);
        }
        return replace;
    }

    public String getPrex() {
        return prex;
    }

    public void setPrex(String prex) {
        this.prex = prex;
    }

    @Override
    public String toString() {
        return "TableInfo{" +
                "name='" + name + '\'' +
                ", comment='" + comment + '\'' +
                ", fields=" + fields +
                ", tableKey=" + tableKey +
                '}';
    }
}
